<template>
  <el-form ref="form">
    <el-form-item label="楼盘名称">
      <span>{{ rowData.real_estate_name }}</span>
    </el-form-item>
    <el-form-item label="选择业态">
      <el-select v-model="rowData.property_type_id" placeholder="请选择">
        <el-option label="住宅" value="1"></el-option>
        <el-option label="商铺" value="2"></el-option>
        <el-option label="写字楼" value="3"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="预计开盘时间">
      <el-col :span="4">
        <el-date-picker
          type="date"
          placeholder="选择日期"
          v-model="form.opening_time"
          style="width: 100%"
        ></el-date-picker>
      </el-col>
    </el-form-item>
    <el-form-item label="准确开盘时间">
      <el-col :span="4">
        <el-date-picker
          type="date"
          placeholder="选择日期"
          v-model="form.accurate_opening_time"
          style="width: 100%"
        ></el-date-picker>
      </el-col>
    </el-form-item>
    <el-form-item label="开盘详情">
      <el-input type="textarea" v-model="form.opening_details"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitBtn">提交</el-button>
      <el-button @click="cancelBtn">取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: ["rowData"],
  data() {
    return {
      // 楼盘id
      floorId: this.rowData.real_estate_id,
      // 业态id
      property_type_id: this.rowData.property_type_id,
      form: {
        // 准确开盘时间
        accurate_opening_time: "",
        // 开盘状态
        open_state: "",
        // 开盘详情
        opening_details: "",
        opening_id: 0,
        // 开盘时间
        opening_time: "",
      },
    };
  },
  methods: {
    submitBtn() {
      this.axios({
        url: "http://106.14.244.89:8080/rema/addPrice",
        method: "post",
        data: {
          // 准确开盘时间
          accurate_opening_time: this.form.accurate_opening_time,
          opening: {
            // 准确开盘时间
            accurate_opening_time: this.form.accurate_opening_time,
            // 开盘状态
            open_state: this.form.open_state,
            // 开盘详情
            opening_details: this.form.opening_details,
            opening_id: 0,
            // 开盘时间
            opening_time: this.form.opening_time,
            property_type: {
              price: {
                average_price: 0,
                lowest_listing_price: 0,
                price_change_date: "string",
                // 价格描述
                price_description: "string",
                price_id: 0,
                // 状态
                price_status: "string",
                //  业态id
                property_type_id: this.property_type_id,
                real_estate_id: this.floorId,
                reason_for_not_passing: "string",
                status: 0,
              },
              property_type_id: this.property_type_id,
              property_type_level: 0,
              property_type_name: "string",
              property_type_p_id: 0,
              property_type_sort: 0,
              status: 0,
            },
            property_type_id: this.property_type_id,
            real_estate_id: this.floorId,
            reason_of_not_passing: "string",
            status: 0,
          },
          opening_details: this.form.opening_details,
          opening_time: this.form.opening_time,
          property_type_id: this.property_type_id,
          // 楼盘id
          real_estate_id: this.floorId,
        },
      })
        .then((data) => {
          // console.log(data);
        })
        .catch((err) => {
          // console.log(err);
        });
    },
  },
  created() {
    // console.log(this.rowData);
  },
};
</script>

<style>
</style>